From 9addcd0f764c76eff84273655481f6c55965a3ee Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Thu, 26 Sep 2024 15:35:01 -0500 Subject: [PATCH] Present user with information about EOL normalization --- src/pgwui_sql/static/pgwui_sql.css | 5 ++++ src/pgwui_sql/static/sql_edit.js | 13 ++++++++ src/pgwui_sql/templates/sql_edit.mak | 45 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/src/pgwui_sql/static/pgwui_sql.css b/src/pgwui_sql/static/pgwui_sql.css index 3594c6d..1524caf 100644 --- a/src/pgwui_sql/static/pgwui_sql.css +++ b/src/pgwui_sql/static/pgwui_sql.css @@ -65,3 +65,8 @@ textarea.sqltext { height: 40em; bottom: 0; background-color: white; /* kludge, see above */ text-align: right; } + +/* The information on EOL normalization */ +tr.eol_info > td > span > p { cursor: pointer; } +tr.eol_info > td > span > p + p { margin-left: 10%; + margin-right: 10%; } diff --git a/src/pgwui_sql/static/sql_edit.js b/src/pgwui_sql/static/sql_edit.js index 7bb0eab..0f2a353 100644 --- a/src/pgwui_sql/static/sql_edit.js +++ b/src/pgwui_sql/static/sql_edit.js @@ -45,3 +45,16 @@ function toggle_sql_used(elem) { sql_text.style.backgroundColor = ''; } }; + +function toggleEOLInfoRow() { + const collapsed = document.getElementById('collapsed_eol_info_id'); + const expanded = document.getElementById('expanded_eol_info_id'); + const collapsed_state = collapsed.getAttribute('hidden'); + if (collapsed_state === null || collapsed_state === 'until-found') { + collapsed.setAttribute('hidden', 'hidden'); + expanded.removeAttribute('hidden'); + } else { + collapsed.removeAttribute('hidden'); + expanded.setAttribute('hidden', 'hidden'); + } +} diff --git a/src/pgwui_sql/templates/sql_edit.mak b/src/pgwui_sql/templates/sql_edit.mak index 213e473..c3acad3 100644 --- a/src/pgwui_sql/templates/sql_edit.mak +++ b/src/pgwui_sql/templates/sql_edit.mak @@ -141,6 +141,50 @@ +<%def name="eol_info_row(tab_index)"> + +

▲ Important information about end-of-line characters

+ + + <% tab_index.inc() %> + + <%def name="download_row(tab_index)"> ## Download @@ -243,6 +287,7 @@ <%def name="controls(tab_index)"> ${self.file_input_row(tab_index)} + ${self.eol_info_row(tab_index)} ${self.null_rep_row(tab_index)} ${self.download_row(tab_index)} ${self.download_as_row(tab_index)} -- 2.34.1